package com.neusoft.neuiotms.dcam.fixed.converter;

import org.springframework.stereotype.Component;

import com.neusoft.bizcore.web.dto.AbstractConverter;
import com.neusoft.neuiotms.dcam.fixed.dto.AssetLifeCycleDTO;
import com.neusoft.neuiotms.dcam.fixed.model.AssetLifeCycle;

@Component
public class AssetLifeCycleConverter extends AbstractConverter<AssetLifeCycle, AssetLifeCycleDTO> {

    @Override
    public AssetLifeCycle toModel(final AssetLifeCycleDTO dto) {
        final AssetLifeCycle model = new AssetLifeCycle();
        model.setCode(dto.getCode());
        model.setContent(dto.getContent());
        model.setLifeCycle(dto.getLifeCycle());
        model.setUserName(dto.getUserName());
        model.setWorkNum(dto.getWorkNum());
        return model;
    }

    @Override
    public AssetLifeCycleDTO toDTO(final AssetLifeCycle model, final boolean forListView) {
        final AssetLifeCycleDTO dto = new AssetLifeCycleDTO();
        dto.setId(model.getId());
        dto.setCode(model.getCode());
        dto.setContent(model.getContent());
        dto.setLifeCycle(model.getLifeCycle());
        dto.setUserName(model.getUserName());
        dto.setCreateTime(model.getCreateTime());
        dto.setWorkNum(model.getWorkNum());
        return dto;
    }

}
